home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13871 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: news.inc.net!news
  2. From: Will Flor <willf@rrgroup.com>
  3. Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.basic.visual.misc
  4. Subject: Re: DLL, VB and Borland C/C++
  5. Date: 27 Mar 1996 18:28:54 GMT
  6. Organization: R R Systems Group Inc.
  7. Message-ID: <4jc1d6$2tv@news.inc.net>
  8. References: <312A0334.AC5@supaero.fr> <4gfg6m$eet@hasle.sn.no> <4hagmf$qc0@donald.interpac.be> <4j5mqr$su7@ohnasn01.sinet.slb.com>
  9. NNTP-Posting-Host: 204.95.173.139
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.2N (Windows; I; 32bit)
  14.  
  15. primaves@manchester.gm.slb.com (Nick Primavesi) wrote:
  16. >tlgnsmd@mail.interpac.be (Michel Lombart) wrote:
  17. >
  18. >>Sylvain Souche <souche@supaero.fr> wrote
  19. >
  20. >>>Hi,
  21. >
  22. >>>I am trying desperatly to call a DLL created with Borland C/C++ 4.5 in a 
  23. >>>VB 3.0 application, but VB always complains about a so called "Bad 
  24. >>>Calling Convention Error". This Error message is not very documented, 
  25. >>>and Borland Help files are worth nothing, so...
  26. >
  27. >> Hi Sylvain.
  28. >
  29. >>Did you use, if necessary,  the "byval" option in your declaration
  30. >>code?
  31. >
  32. >>Michel
  33. >
  34. >I have the same problem with VB4.0 and Visual C++ DLLs
  35. >
  36. >The ByVal option is required but this does not always cure the
  37. >problem.
  38. >
  39.  
  40. This may correct a parameter type error, since if you don't do this, VB
  41. will pass a the parameter's address to the function rather than the
  42. parameter itself.  This can cause bizarre, unpredictable results.
  43.  
  44. >
  45. >VB uses the PASCAL calling convention so the DLL should be compiled
  46. >using FAR PASCAL for 16 bit or __stdcall. This still did not cure my
  47. >problem but it got me closer.
  48. >
  49. >I have just been infomed that my problem is due to the omission of the
  50. >.DEF file by the VC++ compiler now so check that you also have the
  51. >DEF file with the .DLL.
  52. >
  53. >Let me know if this helps and if you discover anything that may help
  54. >me.
  55. >
  56.  
  57. The function doesn't have to be exported in the .DEF file, but it has to be exported 
  58. somehow, or nothing outside the DLL will be able to call it.  IOW, the use of a .DEF 
  59. file isn't mandatory, but it will work that way, if you choose.
  60.  
  61. -Will Flor   willf@rrgroup.com
  62. The R R Systems Group, Inc.
  63.  
  64.  
  65.